package com.hfzy.ihk.common.facade.enums;



import java.util.HashMap;
import java.util.Map;

public enum CityType {

    GZ("1","广州"),
    DG("2","东莞"),
    FS("3","佛山"),
    QY("140","清远");



    private CityType(String value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    private String value;
    private String desc;

    public String getValue() {
        return value;
    }

    public String getDesc() {
        return desc;
    }


    private static Map<String, CityType> valueMap = new HashMap<String, CityType>();
    private static Map<String, CityType> descMap = new HashMap<String, CityType>();

    static {
        for (CityType value : CityType.values())
            valueMap.put(value.getValue(), value);
    }

    public static CityType fromValue(String name) {
        CityType ret = valueMap.get(name);
        if (ret != null)
            return ret;
        else
//            throw new IllegalArgumentException("No enum const "
//                    + CityType.class + "." + name);
        return null;
    }


    static {
        for (CityType value : CityType.values())
            descMap.put(value.getDesc(), value);
    }

    public static CityType fromDesc(String desc) {
        CityType ret = descMap.get(desc);
        if (ret != null)
            return ret;
        else
            throw new IllegalArgumentException("No enum const "
                    + CityType.class + "." + desc);
    }

    @Override
    public String toString() {
        return desc;
    }
}